"""
The strategy behind my script is as simple as to slack with a player who may
slack as well, and to hunt with another player who may hunt too. This way
potential slackers don't take advantage of me and my reputation is kept at a
decent level for the state of the world.

The essence of my script is to collect information of the number of players
that had a reputation in each of the following intervals
{[0, 0.1), [0.1, 0.2), ..., [0.8, 0.9), [0.9, 1]} from the beginning of round 2
(since in round 1 the reputations are set up by default) until the beginning of
the current round.

Let p be a player in player_reputations, then by the information collected the
program can guess for which average number (call it k) p had decided to slack
with another player (let's say it has a k' reputation) when k' < k and decided
to hunt with another player (with k'' reputation) when k'' > k.

In adition, rounds 1 and 2 and rounds where there is only one competitor have
specific algorythms. In round 1 it would only hunt. This is because there is
no information to apply and the worst case for only hunting is that the rest of
players only slack which after all would count as losing only 3(P-1) food
units from the total of 300(P-1), and this sets me with a maximum reputation.
For round 2 it's the same as the information collected after only one round is
irrelevant. Finally, in case the program survives until there is only one
competitor left, the program would slack as that is the dominant strategy for
a one versus one game.
"""

n0, n1, n2, n3, n4, n5, n6, n7, n8, n9 = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0

def hunt_choices(round_number, current_food, current_reputation, m, player_reputations):
    global population
    number_players = len(player_reputations)
    total_reputations = player_reputations + [current_reputation]
    if round_number == 1:
        hunt_decisions = ['h'] * number_players
    elif round_number == 2:
        population = number_players + 1
        hunt_decisions = ['h'] * number_players
        classify(total_reputations, number_players)
    elif number_players == 1:
        hunt_decisions = ['s']
    else:
        hunt_decisions = []
        for i in range(number_players):
            aux = player_reputations[i] * population
            if aux == 0:
                hunt_decisions.append('s')
            elif aux > 0:
                aux = aux - n0
                if aux > 0:
                    aux = aux - n1
                    if aux > 0:
                        aux = aux - n2
                        if aux > 0:
                            aux = aux - n3
                            if aux > 0:
                                aux = aux - n4
                                if aux > 0:
                                    aux = aux - n5
                                    if aux > 0:
                                        aux = aux - n6
                                        if aux > 0:
                                            aux = aux - n7
                                            if aux > 0:
                                                aux = aux - n8
                                                if aux > 0:
                                                    hunt_decisions.append('h')
                                                else:
                                                    if current_reputation < 0.9:
                                                        hunt_decisions.append('h')
                                                    else:
                                                        hunt_decisions.append('s')
                                            else:
                                                if current_reputation < 0.8:
                                                    hunt_decisions.append('h')
                                                else:
                                                    hunt_decisions.append('s')
                                        else:
                                            if current_reputation < 0.7:
                                                hunt_decisions.append('h')
                                            else:
                                                hunt_decisions.append('s')
                                    else:
                                        if current_reputation < 0.6:
                                            hunt_decisions.append('h')
                                        else:
                                            hunt_decisions.append('s')
                                else:
                                    if current_reputation < 0.5:
                                        hunt_decisions.append('h')
                                    else:
                                        hunt_decisions.append('s')
                            else:
                                if current_reputation < 0.4:
                                    hunt_decisions.append('h')
                                else:
                                    hunt_decisions.append('s')
                        else:
                            if current_reputation < 0.3:
                                hunt_decisions.append('h')
                            else:
                                hunt_decisions.append('s')
                    else:
                        if current_reputation < 0.2:
                            hunt_decisions.append('h')
                        else:
                            hunt_decisions.append('s')
                else:
                    if current_reputation < 0.1:
                        hunt_decisions.append('h')
                    else:
                        hunt_decisions.append('s')
        population = population + number_players + 1
        classify(total_reputations, number_players)
    return hunt_decisions

def classify(total_reputations, number_players):
    global n0, n1, n2, n3, n4, n5, n6, n7, n8, n9
    for i in range(number_players + 1):
        if total_reputations[i] < 0.1:
            n0 += 1
        elif total_reputations[i] < 0.2:
            n1 += 1
        elif total_reputations[i] < 0.3:
            n2 += 1
        elif total_reputations[i] < 0.4:
            n3 += 1
        elif total_reputations[i] < 0.5:
            n4 += 1
        elif total_reputations[i] < 0.6:
            n5 += 1
        elif total_reputations[i] < 0.7:
            n6 += 1
        elif total_reputations[i] < 0.8:
            n7 += 1
        elif total_reputations[i] < 0.9:
            n8 += 1
        else:
            n9 += 1
                
def hunt_outcomes(food_earnings):
    pass

def round_end(award, m, number_hunters):
    pass
